<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class mcm extends My_Controller
{
	function __construct()
	{
		parent::__construct();
		
		$this->load->model('mdl_mcm', 'mdl_mcm');				$this->load->library('pdf');				$this->load->library('fungsi');		$this->load->helper('form') ;		$this->load->library('Lib_date');		
		
	}
	
	function index()
	{
		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();			# config pagination		$config['base_url'] = base_url().'index.php/mcm/index/';		$a = $this->mdl_mcm->getItem_count();		foreach ($a->result() as $row)		{			$a = $row->jml;			 		} 				$config['total_rows'] = $a;		$config['per_page'] = '20';		$config['num_links'] = '3';		$config['uri_segment'] = '3';		$config['full_tag_open'] = '';		$config['full_tag_close'] = '';			$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';			$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';		$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';			$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';			$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';		$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			# end config pagination		# get data		$data['param3'] =  $this->uri->segment(3);		$data['results'] = $this->mdl_mcm->getItem($config['per_page'], $this->uri->segment(3));
		# load view		$this->load->view('mcm/mcm_list', $data);		$this->close();
	}	function list_posting2()	{		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();			# config pagination		$config['base_url'] = base_url().'index.php/mcm/index/';		$a = $this->mdl_mcm->getItem2_count();		foreach ($a->result() as $row)		{			$a = $row->jml;			 		} 		$config['total_rows'] = $a;		$config['per_page'] = '10';		$config['num_links'] = '3';		$config['uri_segment'] = '3';		$config['full_tag_open'] = '';		$config['full_tag_close'] = '';			$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';			$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';		$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';			$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';			$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';		$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			# end config pagination		# get data		$data['param3'] =  $this->uri->segment(3);		$data['results'] = $this->mdl_mcm->getItem2($config['per_page'], $this->uri->segment(3));		# load view		$this->load->view('mcm/mcm_list_ak', $data);		$this->close();	}	 
	function insert()
	{		 		
		if ($this->can_insert() == FALSE){
			redirect('auth/failed');
		}
		$this->open();				$config['upload_path'] =  $_SERVER['DOCUMENT_ROOT'].'/simkeu-bp3ti/upload/mcm/';		$config['allowed_types'] = '*';		$config['max_size']  = '1000'; 		$this->load->library('upload', $config);		if ( ! $this->upload->do_upload())		{			$data['error'] 		= $this->upload->display_errors();			$data['excel'] 		= null;			$data['id_mcm']  	= null;			$data['tanggal'] 	= null;			$data['uraian'] 	= null;			$data['filetype'] 	= null;			$data['namafile'] 	= null;			$data['tgl1']		= null;              $data['tgl2']		= null;  			$data['hide'] =0;			$this->load->view('mcm/mcm_add', $data); 		}		else		{		 			$upload_data = $this->upload->data(); 			$nama_lama =  $upload_data['file_name'];			$nama_baru =  'MCM-'. date("Y.m.d") . '-' . date("H.i.s") .'-'.  $upload_data['raw_name'] .  $upload_data['file_ext'] ;            rename($config['upload_path'] . $nama_lama, $config['upload_path'] . $nama_baru);							$this->load->library('excel_reader'); 			$this->excel_reader->setOutputEncoding('CP1251'); 			$file = $config['upload_path'].$nama_baru; 			$this->excel_reader->read($file);			error_reporting(E_ALL ^ E_NOTICE); 			$excel = $this->excel_reader->sheets[0] ; 						$data['id_mcm'] 	= 'MCM-'. date("Y.m.d") . '-' . date("H.i.s");			$data['tanggal'] 	= date("Y-m-d"). '-' . date("H.i.s");			$data['uraian'] 	= $this->input->post('uraian');			$data['filetype'] 	= $this->input->post('jenis_file');			$data['namafile'] 	= $nama_baru;						$this->mdl_mcm->insert_mcm_post($data);								$array_hari = array(1=>"Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu");			$hari = $array_hari[date("N")];            $this->load->library('Lib_date'); 			$data2['tgl1']= $this->lib_date->mysql_to_human($data['tanggal'] );              $data2['tgl2']= $this->lib_date->get_day($data['tanggal'] );  			$data2['hide'] =1;			 			for ($i = 2; $i <= $excel['numRows']; $i++) {  				$data3['id_mcm'] 			= $data['id_mcm'];				//$data3['tanggal'] 			= date('Y-m-d H:i:s', strtotime(preg_replace('#(\d{2})/(\d{2})/(\d{4})\s(.*)#', '$3-$2-$1 $4', $excel['cells'][$i]['1'])));				//$data3['tanggal_val'] 		= date('Y-m-d H:i:s', strtotime(preg_replace('#(\d{2})/(\d{2})/(\d{4})\s(.*)#', '$3-$2-$1 $4', $excel['cells'][$i]['2'])));				$tanggal					= str_replace("/", "-", $excel['cells'][$i]['1']);				$data3['tanggal'] 			= date('Y-m-d H:i:s', strtotime($tanggal));				$tanggal_val				= str_replace("/", "-", $excel['cells'][$i]['2']);				$data3['tanggal_val'] 	 	= date('Y-m-d H:i:s', strtotime($tanggal_val));				$data3['rincian_transaksi'] = str_replace("\n", "", $excel['cells'][$i]['3']);				$data3['no_referensi'] 		= $excel['cells'][$i]['4'];				$data3['debet'] 			= str_replace(",", "", $excel['cells'][$i]['5']);				//$data3['debet'] 			= str_replace(",", ".", $data3['debet']);				$data3['kredit'] 			= str_replace(",", "", $excel['cells'][$i]['6']);				//$data3['kredit'] 			= str_replace(",", ".", $data3['kredit']);				$data3['saldo'] 			= str_replace(",", "", $excel['cells'][$i]['7']);				//$data3['saldo'] 			= str_replace(",", ".", $data3['saldo']);				$data3['uraian'] 			= null;				$data3['parawaba'] 			= null;				$data3['pendapatan'] 			= null;								$syntak = "SELECT * FROM mcm where tanggal like '%".$data3['tanggal']."%' and rincian_transaksi like '%".$data3['rincian_transaksi']."%' and saldo like '%".$data3['saldo']."%'";				 								$sql = mysql_query($syntak);  				if($sql === FALSE) {					die(mysql_error());  				}				$num = mysql_num_rows($sql); 												if($num > 0)				{					while($row = mysql_fetch_array($sql))					{ 						//$this->mdl_mcm->update_mcm($row->id, $data3);						//echo "---";						//echo $excel['cells'][$i]['1']; echo"<br/>";echo $data3['tanggal']; echo"<br/>";					}				}				else				{					$this->mdl_mcm->insert_mcm($data3);										//echo $excel['cells'][$i]['1']; echo"<br/>";echo $data3['tanggal']; echo"<br/>";				} 			}							 						redirect('mcm');		}		
		$this->close();
	}	function verifikasi_detail($id)	{			$data['glid']		= $this->mdl_mcm->get_glid_penerimaan();			$data['results'] 	= $this->mdl_mcm->getItemByID($id); 		$this->load->view('mcm/mcm_verifikasi_detail', $data);		} 		function verifikasi2()	{		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		 		$this->open();				if($_POST)		{			$periode_awal 	= $this->input->post('periode_awal');  			$periode_akhir 	=$this->input->post('periode_akhir'); 		}		else		{			$now = date('m')-1;			$periode_awal = date('Y').'-'.$now.'-1';			$periode_akhir = date('Y').'-'.$now.'-31';				}		 						if (($periode_awal)&&($periode_akhir)){			$datenow=date('Y');			$data['hide']  		= 1;  			$data['results'] 	= $this->mdl_mcm->getItemByDate($periode_awal,$periode_akhir);			$data['count_result']				= sizeof($this->db->select('id')             ->from('mcm')			->where("tanggal BETWEEN '" . $periode_awal . "' AND '" . $periode_akhir .  "'")			->where("kredit != '0.00'")            ->get()			->result());   			$this->load->view('mcm/mcm_verifikasi', $data);		}		$this->close();	}		 function verifikasi()	{		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();				# config pagination		$config['base_url'] = base_url().'index.php/mcm/verifikasi/';				$a = $this->mdl_mcm->getItem_unposting();		foreach ($a->result() as $row)		{			$a = $row->jml;			 		}				$config['total_rows'] = $a;		$config['per_page'] = '20';		$config['num_links'] = '3';		$config['uri_segment'] = '3';	 		$config['full_tag_open'] = '';		$config['full_tag_close'] = '';			$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';			$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';		$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';			$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';			$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';		$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			# end config paginatio		# get data		$data['results'] = $this->mdl_mcm->getItemBy($config['per_page'], $this->uri->segment(3));		$data['param3'] = $this->uri->segment(3);		# load view		$this->load->view('mcm/mcm_verifikasi', $data);		$this->close();	}		function list_unposting_ak(){		if ($this->can_view() == FALSE){			redirect('auth/failed');		}		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();		$config['base_url'] = base_url().'index.php/mcm/list_posting/';		 		$a = $this->mdl_mcm->get_item_list_unposting_count();		foreach ($a->result() as $row)		{			$a = $row->jml;			 		} 		$config['per_page'] = '20';				$config['num_links'] = '5';		$config['uri_segment'] = '3';				$config['full_tag_open'] = '';		$config['full_tag_close'] = '';		$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';		$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';				$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';		$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';				$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';				$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			$data['results'] = $this->mdl_mcm->get_item_list_unposting($config['per_page'], $this->uri->segment(3));		$data['param3'] = $this->uri->segment(3);				$this->load->view('mcm/mcm_list_unposting_ak', $data);		$this->close();	}		function list_posting_ak2(){		if ($this->can_view() == FALSE){			redirect('auth/failed');		}		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();		$config['base_url'] = base_url().'index.php/mcm/list_posting/';		$config['total_rows'] = 		//$this->db->count_all('penerimaan_kas');		sizeof($this->db->select('distinct(glid)')             ->from('penerimaan_kas')			->where('status_posting','0')            ->get()			->result()); 		$config['per_page'] = '10';		$config['num_links'] = '5';		$config['uri_segment'] = '3';				$config['full_tag_open'] = '';		$config['full_tag_close'] = '';		$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';		$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';				$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';		$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';				$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';				$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			$data['results'] = $this->mdl_mcm->get_item_list_unposting($config['per_page'], $this->uri->segment(3));				$this->load->view('mcm/mcm_list_ak', $data);		$this->close();	}		function list_posting_ak(){		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();			# config pagination		$config['base_url'] = base_url().'index.php/mcm/list_posting_ak/';		$a = $this->mdl_mcm->getItem2_count();		foreach ($a->result() as $row)		{			$a = $row->jml;			 		} 		$config['total_rows'] = $a;		$config['per_page'] = '20';		$config['num_links'] = '3';		$config['uri_segment'] = '3';		$config['full_tag_open'] = '';		$config['full_tag_close'] = '';			$config['num_tag_open'] = '<div id="page-info">';		$config['num_tag_close'] = '</div>';			$config['cur_tag_open'] = '<li class="page-current"><strong>';		$config['cur_tag_close'] = '</strong></li>';		$config['prev_link'] = '<li class="page-left"></li>';		$config['prev_tag_open'] = '';		$config['prev_tag_close'] = '';			$config['next_link'] = '<li class="page-right"></li>';		$config['next_tag_open'] = '';		$config['next_tag_close'] = '';			$config['last_link'] = '<li class="page-far-right"></li>';		$config['last_tag_open'] = '';		$config['last_tag_close'] = '';		$config['first_link'] = '<li class="page-far-left"></li>';		$config['first_tag_open'] = '';		$config['first_tag_close'] = '';				$this->pagination->initialize($config);			# end config pagination		# get data		$data['param3'] =  $this->uri->segment(3);		$data['results'] = $this->mdl_mcm->getItem2($config['per_page'], $this->uri->segment(3));		# load view		$this->load->view('mcm/mcm_list_posting_ak', $data);		$this->close();	}			function report_form()	{		$data['can_view'] 	= $this->can_view();		$data['can_insert'] = $this->can_insert();		$data['can_update'] = $this->can_update();		$data['can_delete'] = $this->can_delete();		$this->open();		$this->load->view('mcm/mcm_report_form', $data);		$this->close();	}	
		function report()	{				$periode_awal = $this->uri->segment('3');		$periode_akhir = $this->uri->segment('4'); 		if (($periode_awal)&&($periode_akhir)){					$data['periode_awal']=$periode_awal;			$data['periode_akhir']=$periode_akhir;			$data['results'] 	= $this->mdl_mcm->getItemByDate($periode_awal,$periode_akhir);			$this->load->view('mcm/mcm_report', $data);		}	}	
	function report_excel(){		header("Content-type: application/x-msdownload");		header("Content-Disposition: attachment; filename=rekap_biaya_periode.xls");		echo  $this->input->post('rekap_tabel1');	}	function report_pdf(){		$periode_awal = $this->uri->segment('3');		$periode_akhir = $this->uri->segment('4');		//$data['periode_awal']=$this->fungsi->dateindo3('-',$periode_awal);		//$data['periode_akhir']=$this->fungsi->dateindo3('-',$periode_akhir);		//$datenow=date('Y');		$data['results'] 	= $this->mdl_mcm->getForReportByDate($periode_awal,$periode_akhir); 		//$data['results'] 	= $this->mdl_mcm->getItemByID(6171); 		//$data['date_now']=$this->fungsi->dateindo3('-',date('Y-m-d'));      // $html = $this->load->view('mcm/mcm_report', $data, true);	   $html = $this->load->view('mcm/a',$data, TRUE);		$this->pdf->pdf_create($html, 'MCM');		   //$this->pdf->pdf_create($file_pdf,'cetak'); 	  // $this->load->view('mcm/mcm_report_pdf', $data);	}		function a()	{		$periode_awal = $this->uri->segment('3');		$periode_akhir = $this->uri->segment('4');		//$data['periode_awal']=$this->fungsi->dateindo3('-',$periode_awal);		//$data['periode_akhir']=$this->fungsi->dateindo3('-',$periode_akhir);		//$datenow=date('Y');		$data['results'] 	= $this->mdl_mcm->getForReportByDate($periode_awal,$periode_akhir); 		//$data['results'] 	= $this->mdl_mcm->getItemByID(6171); 		//$data['date_now']=$this->fungsi->dateindo3('-',date('Y-m-d'));       // $html = $this->load->view('mcm/mcm_report', $data, true);	  // $html = $this->load->view('mcm/a',$data, true);		//$this->pdf->pdf_create($html, 'mcm');		   //$this->pdf->pdf_create($file_pdf,'cetak'); 	   $this->load->view('mcm/a', $data);	}		
	function update($id)
	{
		if ($this->can_update() == FALSE){
			redirect('auth/failed');
		}
			
		$this->open();
		
		$data['result'] 		= $this->mdl_mcm->getItemById($id); 
		$data['id_mcm'] = $data['result']->row()->id_mcm;		$data['tanggal'] = $data['result']->row()->tanggal;				$data['uraian'] = $data['result']->row()->uraian;				$data['namafile'] = $data['result']->row()->namafile;				$data['filetype'] = $data['result']->row()->filetype; 
		
		$this->load->view('mcm/mcm_edit', $data);
		
		$this->close();
	}
	
	function process_update()	{		if ($this->can_update() == FALSE){			redirect('auth/failed');		}		 		 		# update mcm		$data['id']					= $this->input->post('id');		$data['id_mcm'] 			= $this->input->post('id_mcm');		$data['tanggal'] 			= $this->input->post('tanggal'); 		$data['uraian'] 			= $this->input->post('uraian'); 		$data['parawaba'] 			=  $this->input->post('parawaba');		$data['pendapatan'] 		=  $this->input->post('pendapatan');				$this->form_validation->set_rules('kas', 'kas', 'required'); 		$this->form_validation->set_rules('pendapatan', 'pendapatan', 'required'); 				$this->form_validation->set_error_delimiters('<div class="error">', '</div>');				$this->form_validation->set_message('required', 'Field %s harus diisi!');		$this->form_validation->set_message('numeric', 'Field %s harus diisi hanya dengan angka!');				if  (($data['pendapatan'] != null) or ($data['pendapatan'] != 0))		{			$data['status_posting'] = "1";			}		else		{			$data['status_posting'] = "0";			}				$data2['kredit1'] 		= str_replace(" ", "", $this->input->post('kredit'));		$data2['kredit2'] 		= str_replace(".", "", $data2['kredit1']);		$data['kredit'] 		= str_replace(",", ".", $data2['kredit2']);				$data2['debet1'] 		= str_replace(" ", "", $this->input->post('debet'));		$data2['debet2'] 		= str_replace(".", "", $data2['debet1']);		$data['debet'] 			= str_replace(",", ".", $data2['debet2']);				if ($this->form_validation->run() == FALSE){						//$this->load->view('barang/barang_add',$data);				echo"<script language='Javascript'>						alert('Tidak ada file yg diupload!')						window.history.back(-1);					</script>";					}else{			$this->mdl_mcm->update_mcm($data['id'], $data);			 						# insert penerimaan kas		$data3['glid'] 			= $this->mdl_mcm->get_glid_penerimaan();			$data3['ket_transaksi'] = $data['uraian']; 		$data3['jumlah']		= $data['kredit'];		$data3['cuid']			= '';		$data3['cdate']			= '';		$data3['tanggal']		= $data['tanggal'];		$data3['status_posting']	= '0';		$data3['mcm']				= $data['id'];		$this->mdl_mcm->insert_penerimaan($data3);			# insert detail penerimaan kas akun kepala 1			$data4['glid'] 			= $data3['glid'] ;					$data4['ket_transaksi']	= $this->input->post('uraian');			$data4['akunid']		= $this->input->post('kas');			$data4['kredit']		= '0';			$data4['debet']			= $data['kredit'];			$data4['status_posting']	= '0';			$data4['cuid']			= '';			$data4['cdate']			= '';			$this->mdl_mcm->insert_detail_penerimaan($data4);		 			# insert detail penerimaan kas akun kepala 4			$data5['glid'] 			= $data3['glid']; 					$data5['ket_transaksi']	= $this->input->post('uraian');			$data5['akunid']		= $this->input->post('pendapatan');			$data5['debet']			= '0';			$data5['kredit']			= $data['kredit'];			$data5['status_posting']	= '0';			$data5['cuid']			= '';			$data5['cdate']			= '';			$this->mdl_mcm->insert_detail_penerimaan($data5);			redirect('mcm/verifikasi'); 				}		 							 			}
	
	function delete($id)
	{
		if ($this->can_delete() == FALSE){
			redirect('auth/failed');
		}
		
		$this->mdl_mcm->delete($id);
		$this->session->set_flashdata('message', 'Data MCM Berhasil dihapus.');
		redirect('mcm');
	}	 	 function detail_mcm(){		$glid1=$this->uri->segment(3);		$glid2=$this->uri->segment(4);		$glid3=$this->uri->segment(5);		$glid=$glid1.'/'.$glid2.'/'.$glid3;		$data['results'] = $this->mdl_mcm->get_detail_mcm($glid);		$this->load->view('mcm/view_detail_mcm', $data);	}				 function posting(){		$glid			= $this->input->post('glid');						for ($i=0;$i<count($glid);$i++){						$rows_ju = $this->mdl_mcm->get_item_penerimaan_kas($glid[$i]);						foreach ($rows_ju->result() as $rows){				$glid_jurnal = $this->mdl_mcm->get_glid_jurnal();				$data_j['GLID']=$glid_jurnal;				$data_j['GLID_PARENT']=$rows->glid;				$data_j['TANGGAL']=$rows->tanggal;				$this->mdl_mcm->insert_j($data_j);								//$glid_jurnal = $this->mdl_mcm->get_glid_jurnal();										$rows_dju = $this->mdl_mcm->get_detail_item_penerimaan_kas($rows->glid);					foreach ($rows_dju->result() as $rows_dju){						$data_dj['GLID']=$glid_jurnal;						$data_dj['AKUNID']=$rows_dju->akunid;						$data_dj['DEBET']=$rows_dju->debet;						$data_dj['KREDIT']=$rows_dju->kredit;						$this->mdl_mcm->insert_detail_j($data_dj);					}												}						$data['status_posting']='1';			$this->mdl_mcm->update_posting_penerimaan_kas($glid[$i],$data);					}		redirect('mcm/list_posting_ak');
	}		function posting_ak(){		$glid			= $this->input->post('glid');						for ($i=0;$i<count($glid);$i++){						$rows_ju = $this->mdl_mcm->get_item_penerimaan_kas($glid[$i]);						foreach ($rows_ju->result() as $rows){				$glid_jurnal = $this->mdl_mcm->get_glid_jurnal();				$data_j['GLID']=$glid_jurnal;				$data_j['GLID_PARENT']=$rows->glid;				$data_j['TANGGAL']=$rows->tanggal;				$this->mdl_mcm->insert_j($data_j);								//$glid_jurnal = $this->mdl_mcm->get_glid_jurnal();										$rows_dju = $this->mdl_mcm->get_detail_item_penerimaan_kas($rows->glid);					foreach ($rows_dju->result() as $rows_dju){						$data_dj['GLID']=$glid_jurnal;						$data_dj['AKUNID']=$rows_dju->akunid;						$data_dj['DEBET']=$rows_dju->debet;						$data_dj['KREDIT']=$rows_dju->kredit;						$this->mdl_mcm->insert_detail_j($data_dj);					}												}						$data['status_posting']='1';			$this->mdl_mcm->update_posting_penerimaan_kas($glid[$i],$data);					}		redirect('mcm/list_posting_ak');	}		function detail_mcm_list(){		$glid1=$this->uri->segment(3);		$glid2=$this->uri->segment(4);		$glid3=$this->uri->segment(5);		$glid=$glid1.'/'.$glid2.'/'.$glid3;		$data['results'] = $this->mdl_mcm->get_detail_mcm_list($glid);		$this->load->view('mcm/view_detail_mcm_list', $data);	}			function ubah_parawaba(){		$glid1=$this->uri->segment(3);		$glid2=$this->uri->segment(4);		$glid3=$this->uri->segment(5);		$glid=$glid1.'/'.$glid2.'/'.$glid3;		$id = $this->mdl_mcm->get_mcm_from_jurnal($glid);		foreach($id->result() as $row)		{			//echo $row->mcm;			$data['results'] = $this->mdl_mcm->get_for_edit_mcm($row->mcm);			$this->load->view('mcm/mcm_verifikasi_detail_ubah', $data);		}	 	}		function ubah_penerimaan(){		$glid1=$this->uri->segment(3);		$glid2=$this->uri->segment(4);		$glid3=$this->uri->segment(5);		$glid=$glid1.'/'.$glid2.'/'.$glid3;		$id = $this->mdl_mcm->get_mcm_from_penerimaan($glid);		foreach($id->result() as $row)		{			//echo $row->mcm;			$data['results'] = $this->mdl_mcm->get_for_edit_mcm($row->mcm);			$this->load->view('mcm/mcm_verifikasi_detail_ubah_semua', $data);		}	 	}		function update_parawaba()	{		$data['id']					= $this->input->post('id'); 				$data['uraian'] 			= $this->input->post('uraian'); 		$data['parawaba'] 			=  $this->input->post('parawaba');		$this->mdl_mcm->update_mcm($data['id'],$data);		redirect('mcm/list_posting_ak');	}		function update_penerimaan()	{							$data['id']					= $this->input->post('id'); 				$data['uraian'] 			= $this->input->post('uraian'); 		$data['parawaba'] 			=  $this->input->post('parawaba');		$this->mdl_mcm->update_mcm($data['id'],$data);				$data2['glid'] 				=  $this->input->post('glid');		$data2['akunid'] 				=  $this->input->post('kas'); 		$this->mdl_mcm->update_penerimaan_1($data2['glid'],$data2);				$data3['akunid'] 		=  $this->input->post('pendapatan');		$this->mdl_mcm->update_penerimaan_4($data2['glid'],$data3);		redirect('mcm/list_unposting_ak/');	}
}